package cm.com.blackboard.DataModule4B2.customizeConfigUtils;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import blackboard.admin.data.datasource.DataSource;
import blackboard.data.BbObject;
import blackboard.persist.Id;
import cn.com.blackboard.DataModule4B2.BBDataUtils.DataSourceUtil;
import cn.com.blackboard.DataModule4B2.util.HierarchicalQueryModel;

public class CommonConfigLoader {

	private static final Logger logger = LoggerFactory.getLogger(CommonConfigLoader.class);
	
	static String profilepath=CommonConfigLoader.class.getClassLoader().getResource("/commonConfig.properties").getPath();
	
    private static OrderedProperties props = new OrderedProperties(); 
    static { 
        try {
            props.load(new FileInputStream(profilepath)); 
        } catch (FileNotFoundException e) {
        	logger.info("please make sure the commonConfig file in correct filepath");
            e.printStackTrace(); 
        } catch (IOException e) { 
        	logger.info("please make sure the commonConfig file in correct filepath");
        } 
    } 
    
    public static String getPropertyByName(String name){
    	return props.getProperty(name);
    }
    
    public static String getCourseIdAppenderSplitor(){
    	return props.getProperty("courseIdAppenderSplitor");
    }
    
    public static String getDefaultDepartmentName(){
    	return props.getProperty("defaultDepartmentName");
    }
    
    public static String getSilkCategorySuffix(){
    	return props.getProperty("silkCategorySuffix");
    }
    
    public static String getSilkPortalRoleSuffix(){
    	return props.getProperty("silkPortalRoleSuffix");
    }

    public static boolean isSilkSuffixAppended(){
    	return Boolean.parseBoolean(props.getProperty("isSilkSuffixAppended"));
    }

}
